package org.fund.base_service.service.impl;

import org.fund.base_service.domain.UserPositonRelation;
import org.fund.base_service.mapper.UserPositonRelationMapper;
import org.fund.base_service.service.UserPositonRelationService;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * (UserPositonRelation)表服务实现类
 *
 * @author makejava
 * @since 2022-03-13 01:28:45
 */
@Service
public class UserPositonRelationServiceImpl implements UserPositonRelationService {
    @Autowired
    private UserPositonRelationMapper userPositonRelationMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param uId 主键
     * @return 实例对象
     */
    @Override
    public UserPositonRelation queryById(Integer uId) {
        return this.userPositonRelationMapper.queryById(uId);
    }

    /**
     * 分页查询
     *
     * @param userPositonRelation 筛选条件
     * @return 查询结果
     */
    @Override
    public PageInfo<UserPositonRelation> queryByPage(UserPositonRelation userPositonRelation) {
        long total = this.userPositonRelationMapper.count(userPositonRelation);
        return null;
    }

    /**
     * 新增数据
     *
     * @param userPositonRelation 实例对象
     * @return 实例对象
     */
    @Override
    public UserPositonRelation insert(UserPositonRelation userPositonRelation) {
        this.userPositonRelationMapper.insert(userPositonRelation);
        return userPositonRelation;
    }

    /**
     * 修改数据
     *
     * @param userPositonRelation 实例对象
     * @return 实例对象
     */
    @Override
    public UserPositonRelation update(UserPositonRelation userPositonRelation) {
        this.userPositonRelationMapper.update(userPositonRelation);
        return this.queryById(userPositonRelation.getUId());
    }

    /**
     * 通过主键删除数据
     *
     * @param uId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer uId) {
        return this.userPositonRelationMapper.deleteById(uId) > 0;
    }
}
